import React, { memo, useEffect } from 'react'
import {useLocation, useNavigate, useRoutes} from 'react-router-dom'
import route from './route'
const App = memo(() => {
  const location=useLocation()
  const navigate=useNavigate()
  let token=localStorage.getItem('token')
     useEffect(()=>{
        if(!token&&location.pathname!='/Deng'){
          navigate('/Deng')
        }
     },[location])
  return (
    <div>
      {useRoutes(route)}
    </div>
  )
})

export default App